home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / µSim 1.0.5 / source / Globals.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-22  |  8.0 KB  |  467 lines  |  [TEXT/CWIE]

  1. #ifndef __ICTYPES__
  2. #include <ICTypes.h>
  3. #endif
  4.  
  5. #if GENERATINGCFM
  6.  
  7.    enum {
  8.       myUppListClickLoopProcInfo = kRegisterBased
  9.       | RESULT_SIZE(kNoByteCode)
  10.       | REGISTER_RESULT_LOCATION(kCCRegisterZBit)
  11.    };
  12.    
  13.    #define MyNewListClickLoopProc(userRoutine)  \
  14.       (ListClickLoopUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), \
  15.       myUppListClickLoopProcInfo, GetCurrentISA())
  16.          
  17.    #define kListClickLoopTrue false
  18.    #define kListClickLoopFalse true
  19.       
  20. #else
  21.  
  22.    #define MyNewListClickLoopProc(userRoutine)  \
  23.       (ListClickLoopUPP)(userRoutine)
  24.          
  25.    #define kListClickLoopTrue true
  26.    #define kListClickLoopFalse false
  27.  
  28. #endif
  29.  
  30. /* balloon help */
  31. enum balllll {
  32. kBalloons_Anim = 1010,
  33. kBalloons_Regs,
  34. kBalloons_MPrg,
  35. kBalloons_Dump,
  36. kBAnim_ALatch = 1,
  37. kBAnim_BLatch,
  38. kBAnim_MAR,
  39. kBAnim_MBR,
  40. kBAnim_AMUX,
  41. kBAnim_Shifter,
  42. kBAnim_Inc,
  43. kBAnim_MMUX,
  44. kBAnim_MPC,
  45. kBAnim_ALU,
  46. kBAnim_MSL,
  47. kBAnim_MIR,
  48. kBAnim_Regs,
  49. kBAnim_CStore,
  50. kBAnim_MAP,
  51. kBRegs_Base = 1,
  52. kBRegs_PC,
  53. kBRegs_AC,
  54. kBRegs_SP,
  55. kBRegs_BP,
  56. kBRegs_IR,
  57. kBRegs_A,
  58. kBRegs_B,
  59. kBRegs_C,
  60. kBRegs_D,
  61. kBRegs_E,
  62. kBRegs_X12,
  63. kBRegs_X11,
  64. kBRegs_Lo8,
  65. kBMPr_ABus = 1,
  66. kBMPr_BBus,
  67. kBMPr_CBus,
  68. kBMPr_MAR,
  69. kBMPr_MBR,
  70. kBMPr_BusReq,
  71. kBMPr_Shifter,
  72. kBMPr_Branch,
  73. kBMPr_ALU,
  74. kBMPr_ABusRadio,
  75. kBMPr_MBRRadio,
  76. kBMPr_MAP,
  77. kBMPr_BranchTo,
  78. kBMPr_Comment,
  79. kBMPr_CommentsList,
  80. kBMPr_ConvInstrList,
  81. kBDump_Contents = 1,
  82. kBDisasm_Contents,
  83. kBIO_Contents
  84. };
  85.  
  86. /*    kScrollbarAdjust and kScrollbarWidth are used in calculating
  87.     values for control positioning and sizing. */
  88. enum {
  89. kScrollbarAdjust = 15,
  90. kScrollbarWidth
  91. };
  92.  
  93. enum {
  94. khiliteGhost = 50    /* defined in Inside Mac V, but NOT in QuickDraw.h: why??? */
  95. };
  96.  
  97. enum suoni {
  98. kSndPinzatrice = 256
  99. };
  100.  
  101. /* Menu list resource IDs */
  102. enum {
  103. kRes_Menu_HMemory = 1,
  104. kRes_Menu_HRegs,
  105. kRes_Menu_HDisasm,
  106. kRes_Menu_HDump,
  107. kRes_Menu_PopDump = 264,
  108.  
  109. kRes_Menu_Windows = 131,
  110. kRes_Menu_Control,
  111. kRes_Menu_Assembler
  112. };
  113.  
  114. enum {
  115. kD_Edit = 1,
  116. kD_Disasm = 3,
  117. kD_DisasmFrom,
  118. kD_DumpFrom
  119. };
  120.  
  121. enum {
  122. kMItem_About__Simulato = 1
  123. };
  124.  
  125. enum fileitems {
  126. kMItem_New = 1,
  127. kMItem_Open_Control_St,
  128. kMItem_Close = 4,
  129. kMItem_Save_Control_St,
  130. kMItem_Save_Control_St2,
  131. kMItem_Save_CS_Stationery,
  132. kMItem_Revert_to_Saved,
  133. kMItem_HMem = 10,
  134. kMItem_HRegs,
  135. kMItem_Page_Setup = 13,
  136. kMItem_Print,
  137. kMItem_Prefs = 16,
  138. kMItem_Quit = 18
  139. };
  140.  
  141. enum {
  142. kMItem_Insert = 9,
  143. kMItem_Delete,
  144. kMItem_FirstInternet = 12,
  145. kMItem_CopyBugReport = 12,
  146. kMItem_CopyEmailAddr,
  147. kMItem_CopyWWWURL,
  148. kMItem_SendEmail = 16,
  149. kMItem_ShowWWWPage,
  150. kMItem_LastInternet = kMItem_ShowWWWPage
  151. };
  152.  
  153. enum windowsitems {
  154. kMItem_Animation = 1,
  155. kMItem_Registers,
  156. kMItem_IO,
  157. kMItem_Microprogram,
  158. kMItem_Disasm,
  159. kMItem_Dump
  160. };
  161.  
  162. enum hieritems {
  163. kMItem_Open = 1,
  164. kMItem_Save_As
  165. };
  166.  
  167. enum controlitems {
  168. kMItem_Go = 1,
  169. kMItem_Stop,
  170. kMItem_StepSub = 4,
  171. kMItem_StepMicro,
  172. kMItem_StepInstr,
  173. kMItem_ResetMem = 8,
  174. kMItem_ResetRegs,
  175. kMItem_Disasmfrom = 11,
  176. kMItem_Dumpfrom,
  177. kMItem_SelectCurMPC
  178. };
  179.  
  180. enum asmitems {
  181. kMItem_Assemble_file = 1,
  182. kMItem_AsmPrefs = 3
  183. };
  184.  
  185. /* sizes */
  186. enum sizes {
  187. kNUMOFPARTS = 10,
  188. kNUMOFSTATEPARTS = 23,
  189. kSIZE_RAM = 128*1024L,
  190. kSIZE_ASSMEM = 256,
  191. kSIZE_CSMEM = 512
  192. };
  193.  
  194. /* registers */
  195. enum registers {
  196. kREG_PC = 0,
  197. kREG_AC,
  198. kREG_SP,
  199. kREG_BP,
  200. kREG_IR,
  201. kREG_A,
  202. kREG_B,
  203. kREG_C,
  204. kREG_D,
  205. kREG_E,
  206. kREG_EXT12,
  207. kREG_EXT11,
  208. kREG_LOW8,
  209. kREG_ZERO,
  210. kREG_ONE,
  211. kREG_MINUS1,
  212. kNUMOFREGS
  213. };
  214.  
  215. enum micstatus {
  216. kST_STOPPED = 0,
  217. kST_GOING,
  218. kST_STEPASM,
  219. kST_STEPMPROG,
  220. kST_STEPSUBCYC
  221. };
  222.  
  223. /* resources types, file types, creator */
  224. enum filetypes {
  225. krInstructions = 'OPCO',
  226. krHandlers = 'HAND',
  227. kFTY_CSTORE = 'µPRG',
  228. kFTY_RAM = 'µRAM',
  229. kFCR_MINE = 'µSIM',
  230. kFTY_CSTOREPAD = 'sPRG',
  231. kFTY_REG = 'µREG'
  232. };
  233.  
  234. /* alerts */
  235.  
  236. enum somealerts {
  237. kALRT_RESETMEM = 128,
  238. kALRT_NOSAFESAVE = 129,
  239. kALRT_NOSAVE = 132,
  240. kALRT_RESETREGS = 139,
  241. kALRT_STKOVERFLOW = 140,
  242. kALRT_MEMTOOFULL = 141,
  243. kALRT_REVERT,
  244. kALRT_CPURUNNING = 143,
  245. kALRT_STKUNDERFLOW = 144,
  246. kALRT_INFLOOP,
  247. kALRT_TOSHELL,
  248. kALRT_WRONGEXISTINGDOC,
  249. kALRT_SAVE = 200
  250. };
  251.  
  252. /* strings */
  253. enum {
  254. kSTR_PREFSFILENAME = 138
  255. };
  256.  
  257. enum {
  258. kSTR_RAMPROMPT = 133,
  259. kSTR_RAMDEFNAME,
  260. kSTR_REGSPROMPT = 139,
  261. kSTR_REGSDEFNAME
  262. };
  263.  
  264. /* save selectors */
  265. enum savesel {
  266. kGOT_SAVE = 0,
  267. kGOT_SAVEAS,
  268. kGOT_SAVESTATIONERY
  269. };
  270.  
  271. enum defaultregs {
  272. kPCStart = 8192,
  273. kStackBase = 65536-4098,
  274. kStackSize = 1024,
  275. kPCExitToShell = 4096,
  276. kIllegalVector = 3,
  277. kIllegalHandler = 0x300,
  278. kIllegalHandlerCode = 128
  279. };
  280.  
  281. enum myAEIDs {
  282. kAEmySignalIO = 'I/O '
  283. };
  284.  
  285. enum editdialogstrs {
  286. kInThe = 0,
  287. kAtMem,
  288. kValueFollow = 130
  289. };
  290.  
  291. enum {
  292. kCurPrefsVersion = 4
  293. };
  294.  
  295. enum {
  296. kfIsStationery = (1 << 11)
  297. //fNameLocked = (1 << 12)
  298. };
  299.  
  300.  
  301. /* ======================================================= */
  302.  
  303. union u_mir {
  304.     struct {
  305.         unsigned    amux    : 1;
  306.         unsigned    cond    : 2;
  307.         unsigned    alu        : 2;
  308.         unsigned    shift    : 2;
  309.         unsigned    mbr        : 1;
  310.         unsigned    rd        : 1;
  311.         unsigned    wr        : 1;
  312.         unsigned    mar        : 1;
  313.         unsigned    dsc        : 1;
  314.         unsigned    a        : 4;
  315.         unsigned    b        : 4;
  316.         unsigned    c        : 4;
  317.         unsigned    map        : 1;
  318.         unsigned    addr    : 7;
  319.         } bits;
  320.     unsigned long cstore;
  321.     };
  322.  
  323. typedef union u_mir un_mir;
  324.  
  325.  
  326. #if defined(powerc) || defined (__powerc)
  327. #pragma options align=mac68k
  328. #endif
  329. struct ROpcode {
  330.     OSType    instr;
  331.     Byte    length;
  332.     Byte    classe;
  333.     Byte    offsetHB;
  334.     Byte    offsetLB;
  335.     Byte    lastHB;
  336.     Byte    lastLB;
  337.     };
  338. #if defined(powerc) || defined(__powerc)
  339. #pragma options align=reset
  340. #endif
  341.  
  342. typedef struct ROpcode ROpcode;
  343. typedef ROpcode *ROpcodePtr;
  344. typedef ROpcodePtr *ROpcodeHandle;
  345.  
  346. #if defined(powerc) || defined (__powerc)
  347. #pragma options align=mac68k
  348. #endif
  349. struct ROpcodeDisasm {
  350.     OSType    instr;
  351.     Byte    length;
  352.     Byte    classe;
  353.     short    first;
  354.     short    last;
  355.     };
  356. #if defined(powerc) || defined(__powerc)
  357. #pragma options align=reset
  358. #endif
  359.  
  360. typedef struct ROpcodeDisasm ROpcDisasm;
  361. typedef ROpcDisasm *ROpcDisasmPtr;
  362. typedef ROpcDisasmPtr *ROpcDisasmHandle;
  363.  
  364. #ifndef __FABCURSORBALLOON__
  365. #include    "CursorBalloon.h"
  366. #endif
  367.  
  368. typedef struct {
  369.     FabWindowPtr    docWindow;
  370.     TEHandle        docTE;
  371.     ControlHandle    docVScroll;
  372.     ControlHandle    docHScroll;
  373. } DocumentIORecord, *DocumentIOPeek;
  374.  
  375.  
  376. #if defined(powerc) || defined (__powerc)
  377. #pragma options align=mac68k
  378. #endif
  379. struct myprefs {
  380.     short    prefsVersion;
  381.     short    RegsBase;
  382.     Rect    IOUserState;
  383.     Point    AnimTopLeft;
  384.     Point    RegsTopLeft;
  385.     Point    MProgTopLeft;
  386.     Point    DumpTopLeft;
  387.     Point    DisasmTopLeft;
  388.     Point    generalPrefsTL;
  389.     Point    asmPrefsTL;
  390.     Point    editValueTL;
  391.     Point    aboutTL;
  392.     Point    creditsTL;
  393.     unsigned short    DefPCValue;
  394.     unsigned short    DefSPValue;
  395.     short    DefStkSize;
  396.     short    DumpHeight;
  397.     short    DumpScrollVal;
  398.     short    DisasmHeight;
  399.     short    DisasmScrollVal;
  400.     Boolean AnimVisible;
  401.     Boolean    RegsVisible;
  402.     Boolean    IOVisible;
  403.     Boolean    DumpVisible;
  404.     Boolean    DisasmVisible;
  405.     Boolean infLoopsDetect;
  406.     Boolean    remembWind;
  407.     Boolean    NeXTScroll;
  408.     };
  409. #if defined(powerc) || defined(__powerc)
  410. #pragma options align=reset
  411. #endif
  412.  
  413. /************************************************************/
  414. #pragma internal on
  415.  
  416. extern EventRecord    gMyEvent;
  417. extern GrowZoneUPP        gMyGrowZoneUPP;
  418. extern ListClickLoopUPP    gInstrClikLoopUPP;
  419. extern ListClickLoopUPP    gCommentClikLoopUPP;
  420. extern ListClickLoopUPP    gSwitchCursClikLoopUPP;
  421. extern ICInstance    gICinst;
  422. extern TEHandle    gTheInput;
  423. extern unsigned long    gSleep;
  424. extern CursHandle    gWatchHandle, gIBeamHandle, gPlusHandle;
  425.  
  426. extern Ptr    gMMemory;
  427. extern Ptr    gAssMemory;
  428. extern union u_mir *gCsMemory;
  429.  
  430. extern MenuRef    gMenu_Apple;
  431. extern MenuRef    gMenu_File;
  432. extern MenuRef    gMenu_Edit;
  433. extern MenuRef    gMenu_Windows;
  434. extern MenuRef    gMenu_Control;
  435. extern MenuRef    gMenu_Assembler;
  436. extern MenuRef    gPopMenu;
  437.  
  438.  
  439. extern WindowPtr    gWPtr_Animation;
  440. extern WindowPtr    gWPtr_Dump;
  441. extern WindowPtr    gWPtr_Microprogram_Ed;
  442. extern WindowPtr    gWPtr_Registers;
  443. extern WindowPtr    gWPtr_Disasm;
  444. extern WindowPtr    gWPtr_IO;
  445.  
  446. extern DocumentIORecord gIODoc;
  447.  
  448. extern struct myprefs gPrefs;
  449.  
  450. extern short    gRegs[kNUMOFREGS];
  451. extern short    gParts[kNUMOFPARTS];
  452.  
  453. extern unsigned short    gILCBase;
  454. extern ICError    gICerr;
  455. extern short    gRstatus, gZoomFactor;
  456. extern short    gSubclk;
  457. extern Boolean    gDoneFlag;
  458. extern Boolean  gInTheForeground;
  459. extern Boolean    gHasColorQD, gPwrManagerIsPresent;
  460. extern Boolean gDragManagerActive;
  461. #pragma internal reset
  462.  
  463. //====================================================================
  464.  
  465. #define PTR2MEMWORD(address)    ((unsigned long)((Ptr)(address) - gMMemory) >> 1)
  466.  
  467.